<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>病案批量浏览申请记录</title>
</head>
<body>
<div class="easyui-panel" data-options="fit:true,border:0">
		<div id="" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'nouth',split:true" style="width:100%;height:65%;border-left:0;">
				<div id="batchApplyBar" class="paddingTBL">
				        <label>申请日期&nbsp;</label>
						<input type="text" class="easyui-datebox" id="batchApply_date1" data-options="width:115,height:24"/>
						<label>&nbsp;至&nbsp;</label>
						<input type="text" class="easyui-datebox" id="batchApply_date2" data-options="width:115,height:24"/>
						<label class="paddingL">申请目的&nbsp;</label>
						<input type="text" class="" id="batchApply_purpose" data-options="width:120,height:24"/>
						<label class="paddingL">审批状态&nbsp;</label>
						<select class="easyui-combobox" id="batchApply_status" data-options="width:100,height:'auto'">
							<option value="0" selected="selected">全部</option>
				            <option value="1" >中间流程</option>
				            <option value="2" >批准</option>
				            <option value="3">驳回</option>
						</select>
						<span class="paddingbtn"></span>
						<a href="#" class="easyui-linkbutton" onclick="func.batchApplyQuery()">检 索</a>
				</div>
				<table id="batchApplyGrid"></table>
			</div> 	 
				
			<div data-options="region:'south',title:'审批信息',split:true,collapsible:false" style="width:100%;height:35%;border-left:0;border-bottom:0;">
				<table id="batchApplyInfo"></table>			
			</div>
		</div>
</div>

<script type="text/javascript">
//获取申请目的
$("#batchApply_purpose").combobox({
	url:ctx + "/MedicalShootManage/getSqmd",
	valueField:"fid",
	textField:"fname",
	width:100, 
	height:24
});


//加载数据表格
$("#batchApplyGrid").datagrid({
	url:'',
	toolbar:"#batchApplyBar",
	rownumbers:true,
	fitColumns:false,
	border : false,
	striped : true,
	fit : true,
	singleSelect: true,
	pagination : true,
	pageSize : 20,
	pageList : [ 20, 30,50 ],
	columns:[[
        {field:'operat',title:'操作',width:80,align:'center',
        	formatter:function(value,row,index){
        		return "<button class='shootBtn' onclick='func.list("+index+")'>列表</button>";
        	}
        },  
		{field:'fshzt',title:'状态',width:80,align:'center'},  
		{field:'fdqlc',title:'当前流程',width:100,align:'center'},  
		{field:'fsqrq',title:'申请时间',width:100,align:'center',
			formatter:function(value){
				return new Date(value).format("yyyy-MM-dd");
			}	
		},  
		{field:'fsqdays',title:'天数',width:50,align:'center'},  
		{field:'fqsrq',title:'开始时间',width:100,align:'center',
			formatter:function(value){
				return new Date(value).format("yyyy-MM-dd");
			}	
		},  
		{field:'fjsrq',title:'结束时间',width:100,align:'center',
			formatter:function(value){
				return new Date(value).format("yyyy-MM-dd");
			}	
		},  
		{field:'fsqtjwz',title:'申请条件',width:120,align:'center',
			formatter:function(value){
				return "<span title='"+value+"'>"+value+"</span>";
			}
		},  
		{field:'fname',title:'申请目的',width:80,align:'center'},  
		{field:'fsqid',title:'申请ID',width:1,align:'center',hidden:true},  
		{field:'fshztbh',title:'状态编号',width:80,align:'center'},  
		{field:'xx',title:'条件类型',width:80,align:'center'} 
		
	 ]],
	 onSelect : function(index,row){
		 //根据住院ID获取病案申请详细记录
		 $("#batchApplyInfo").datagrid({
				url:ctx + "/Archiving/getBatchApplyDetails",
				queryParams:{
					"fsqid" : row.fsqid
				}
			});
	 }
	       
});

//加载想详情表格
$("#batchApplyInfo").datagrid({
	toolbar:"#",
	fitColumns:true,
	border : false,
	striped : true,
	fit : true,
	singleSelect: true,
	pagination : true,
	pageSize : 20,
	pageList : [ 20, 30,50 ],
	columns:[[
		{field:'fspzt',title:'状态',width:80,align:'center'},  
		{field:'fdqlc',title:'流程名称',width:100,align:'center'},  
		{field:'',title:'流程类型',width:80,align:'center',hidden:true},  
		{field:'fspy',title:'审批人',width:80,align:'center'},  
		{field:'fsprq',title:'审批时间',width:100,align:'center',
			formatter:function(value){
				return new Date(value).format("yyyy-MM-dd");
			}
		},  
		{field:'fremark',title:'审批描述',width:100,align:'center'}  
	   	]]
});


var func = {
	list :function(index){ //获取满足条件的列表
		var row = $("#batchApplyGrid").datagrid("getRows")[index]
		var url = ctx + "/Archiving/BatchApplyList?fsqid="+row.fsqid
		addTab("批量申请病案列表", url, "", false);
	},
	batchApplyQuery : function(){ //加载表格中数据
		var date1 = $("#batchApply_date1").datebox("getValue");
		var date2 = $("#batchApply_date2").datebox("getValue");
		var purpose = $("#batchApply_purpose").combobox("getValue");
		var status = $("#batchApply_status").combobox("getValue");
		$("#batchApplyGrid").datagrid({
			url:ctx + "/Archiving/getBatchApplyRecord",
			queryParams:{
				"date1" : date1,
				"date2" : date2,
				"status" : status,
				"purpose" : purpose,
			}
		});
	}
		
}
</script>
</body>
</html>